﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

//JIFEN ADDED FOR　CUSTOMER SERVICE ALERT MANAGEMENT

public partial class customer_service_alert_management : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ((AfterLogin)this.Master).mainCategory = "SERVICE";
        if (!IsPostBack)
        {
            
            this.cbalert_occured_payment.Checked = false;
            this.cbalert_recurring_bill_payment.Checked = false;
            this.cbalert_change_personal_particulars.Checked = false;
            this.cbalert_change_of_PIN_no.Checked = false;
            this.cbalert_new_product_approved.Checked = false;
            this.cbalert_update_debit_limit.Checked = false;
            Alert alert = new Alert();
            String custId = Session["userId"] as String;
            DataSet ds = alert.getAlertSettings(custId);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                String itemName = ds.Tables[0].Rows[i]["itemName"] as String;
                String inUsing = ds.Tables[0].Rows[i]["inUsing"] as String;
                if (!"Y".Equals(inUsing)) continue;

                if ("PAYMENT".Equals(itemName))
                {
                    this.cbalert_recurring_bill_payment.Checked = true;
                }
                else if ("FUND_TRANSFER".Equals(itemName))
                {
                    this.cbalert_occured_payment.Checked = true;
                }
                else if ("PERSONAL_PARTICULARS".Equals(itemName))
                {
                    this.cbalert_change_personal_particulars.Checked = true;
                }
                else if ("PERSONAL_PIN".Equals(itemName))
                {
                    this.cbalert_change_of_PIN_no.Checked = true;
                }
                else if ("APPLICATION".Equals(itemName))
                {
                    this.cbalert_new_product_approved.Checked = true;
                }
                else if ("CARD_LIMIT".Equals(itemName))
                {
                    this.cbalert_update_debit_limit.Checked = true;
                }
            }
        }
    }

    protected void Bnt_OK_Click(object sender, EventArgs e)
    {
        Alert alert = new Alert();
        String custId = Session["userId"] as String;
 
        alert.settingAlert(custId,"PAYMENT","",this.cbalert_recurring_bill_payment.Checked);


        alert.settingAlert(custId, "FUND_TRANSFER", "", this.cbalert_occured_payment.Checked);
       

        alert.settingAlert(custId, "PERSONAL_PARTICULARS", "", this.cbalert_change_personal_particulars.Checked);
      

        alert.settingAlert(custId, "PERSONAL_PIN", "", this.cbalert_change_of_PIN_no.Checked);
       

        alert.settingAlert(custId,"APPLICATION","",this.cbalert_new_product_approved.Checked);
       

        alert.settingAlert(custId,"CARD_LIMIT","",this.cbalert_update_debit_limit.Checked);
       

    }
}